package networkTraining;

public class DataSet
{

	private String[] inputNames;
	private double[] inputValues;
	private String[] outputNames;
	private double[] outputValues;

	public DataSet(String[] inputNames, double[] inputValues, String[] outputNames, double[] outputValues)
	{
		super();
		this.inputNames = inputNames;
		this.inputValues = inputValues;
		this.outputNames = outputNames;
		this.outputValues = outputValues;
	}

	public String[] getInputNames()
	{
		return inputNames;
	}

	public String[] getOutputNames()
	{
		return outputNames;
	}

	public void setInputData(String[] inputNames, double[] inputValues)
	{
		this.inputNames = inputNames;
		this.inputValues = inputValues;
	}

	public double getInputValue(String inputName)
	{
		int index = -1;
		for (int i = 0; i < inputNames.length; i++)
		{
			if (inputNames[i].equalsIgnoreCase(inputName))
			{
				index = i;
				break;
			}
		}

		double value = 0;
		if (index != -1)
			value = inputValues[index];

		return value;
	}

	public void setDesiredOutputData(String[] outputNames, double[] outputValues)
	{
		this.outputNames = outputNames;
		this.outputValues = outputValues;
	}

	public double getOutputValue(String outputName)
	{
		int index = -1;
		for (int i = 0; i < outputNames.length; i++)
		{
			if (outputNames[i].equalsIgnoreCase(outputName))
			{
				index = i;
				break;
			}
		}

		double value = 0;
		if (index != -1)
			value = outputValues[index];

		return value;
	}

}
